package com.gcd.knowledge;

public abstract class Tree {
	protected Node[] nodes;

	public Node find(String nodeName) {
		if (nodes == null) {
			return null;
		}

		for (int i = 0; i < nodes.length; ++i) {
			if (nodes[i].name.equals(nodeName)) {
				return nodes[i];
			}
		}
		return null;
	}

	public Node getNode(int index) {
		if (nodes != null && index < nodes.length) {
			return nodes[index];
		}
		return null;
	}
}
